﻿using System.Collections.Generic;
using EasyPhysic.Collider;
using UnityEngine;


namespace EasyPhysic.Manager
{
   
    public class PhysicManager 
    {
        Dictionary<int,IPhysicSystem> _physicSystems = new Dictionary<int, IPhysicSystem>();

        
        public void BindingCollider(ColliderWrapper wrapper)
        {
            _physicSystems[1].RegisterCollider(wrapper);
        }
        
        public IPhysicSystem CreatPhysicSystem<T>(int id) where T : IPhysicSystem,new()
        {
            IPhysicSystem system = null;
            if (_physicSystems.ContainsKey(id))
            {
                system= _physicSystems[id];
            }
            else
            {
                system = new T();
                _physicSystems.Add(id,system);
            }
            return system;
        }
        
        public IPhysicSystem GetPhysicSystem(int id)
        {
            return _physicSystems.ContainsKey(id) ? _physicSystems[id] : null;
        }

        private void OnDrawGizmos()
        {
            
        }
    }
}